import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { config } from 'config';
import { Logger } from '@nestjs/common';
import { swagger } from './swagger';

async function bootstrap() {
    const app = await NestFactory.create(AppModule, {
        logger: !config.debugMode ? ['log', 'error', 'warn'] : ['log', 'debug', 'error', 'warn', 'verbose'],
    });

    const PORT = config.server.port;
    app.setGlobalPrefix('api');
    swagger(app);

    await app.listen(PORT, () => Logger.log(`Server started on port = ${PORT}`));
}
bootstrap();
